#include "widget.h"
#include <QSoundEffect>//音频类
#include <QApplication>
#include<QMainWindow>
#include"startwindow.h"

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QSoundEffect soundEffect;
    soundEffect.setSource(QUrl::fromLocalFile(":/map/bgmzhiyin.wav"));//背景音乐
    soundEffect.setVolume(0.5); // 设置音量
    soundEffect.play();

    StartWindow startWindow; // 创建初始界面实例
    Widget gameWindow; // 创建游戏窗口实例
    startWindow.show(); // 显示初始界面

    QObject::connect(&startWindow, SIGNAL(startGameSignal()), &gameWindow, SLOT(show()));// 连接信号与槽,开始游戏
    QObject::connect(&gameWindow, &Widget::gameFinished, &startWindow, &StartWindow::onGameFinished);// 连接信号与槽,退出游戏

    return a.exec();
}
